<?php 
include_once(''.P.'/public/header.html');
?>

<script type="text/javascript" src="res/bootstrapplugin/jquery-bootstable.js"></script>
<script type="text/javascript" src="res/menu/jquery-rockmenu.js"></script>
<link rel="stylesheet" type="text/css" href="res/menu/jquery-rockmenu.css">


<script>

function initbody(){
	deleterecordurl = '?m=usera&d=manage&cnum='+cnum+'&a=delusera';
	table = $('#viewshow').bootstable({
		url:'index.php?d=manage&cnum='+cnum+'&m=usera&a=data',method:'get',celleditor:true,tablename:'7',
		cellurl:'index.php',fanye:true,cellurl:'index.php?a=savecell',statuschange:false,
		columns:[{
			text:'ID',dataIndex:'id',sortable:true
		},{
			text:'姓名',dataIndex:'name'
		},{
			text:'性别',dataIndex:'gender',renderer:function(v){
				if(v=='1')v='男';
				if(v=='2')v='女';
				return v;
			}
		},{
			text:'用户名',dataIndex:'user'
		},{
			text:'职位',dataIndex:'position',editor:true
		},{
			text:'所在部门',dataIndex:'deptname'
		},{
			text:'直属上级',dataIndex:'superman'
		},{
			text:'手机号',dataIndex:'mobile'
		},{
			text:'邮箱',dataIndex:'email'
		},{
			text:'办公电话',dataIndex:'tel',editor:true
		},{
			text:'级别',dataIndex:'type',sortable:true,renderer:function(v){
				if(v=='0')v='用户';
				if(v=='1')v='管理员';
				if(v=='2')v='创建人';
				return v;
			}
		},{
			text:'排序号',dataIndex:'sort',sortable:true,editor:true,type:'number',textmsg:'越小越靠前'
		},{
			text:'通讯录',dataIndex:'istxl',sortable:true,editor:true,type:'checkbox'
		},{
			text:'UID',dataIndex:'uid',sortable:true
		},{
			text:'状态',dataIndex:'status',sortable:true,renderer:function(v){
				if(v=='1')v='<font color="green">已关注</font>';
				if(v=='2')v='<font color="gray">停用</font>';
				if(v=='0')v='<font color="blue">未关注</font>';
				return v;
			}
		},{
			text:'',dataIndex:'opts',align:'left',renderer:function(s,d){
				var str = '<a class="zhu" href="?m=usera&d=manage&cnum='+cnum+'&a=form&id='+d.id+'">编辑</a>';
				if(d.uid!=adminid)str+='&nbsp;<a class="zhu" href="javascript:;" onclick="deleterecord('+d.id+',deleterecordurl,false)">删</a>';
				if(d.uid!=adminid){
					if(d.status=='2'){
						str+='&nbsp;<a class="zhu" style="color:blue" href="javascript:;" onclick="tingyong('+d.id+',0)">启用</a>';
					}else{
						str+='&nbsp;<a class="zhu" style="color:red" href="javascript:;" onclick="tingyong('+d.id+',2)">停用</a>';
					}
				}
				return str;
			}
		}]
	});
}
function tingyong(id,zt){
	var url = 'index.php?d=manage&cnum='+cnum+'&m=usera&a=change&id='+id+'&zt='+zt+'';
	js.loading('切换中...');
	$.get(url,function(){
		js.msgok('切换成功');
		table.reload();
	});
}
</script>
</head>

<body>

<?php 
include_once(''.P.'/public/top_manage.html');
?>

<div align="center">

<div style="margin:20px;max-width:1500px" align="left">
	<div style="color:#cccccc">
		<a href="?d=manage&cnum=<?=$cnum?>" class="zhu"><?=lang('manage.home')?></a> &gt;
		<a href="" class="zhu"><?=lang('manage.usera')?></a>
	</div>
	<div class="mainbody">
		<div style="padding:10px">
			<div style="padding:5px 0px">
			<table width="100%"><tr>
			<td align="left">
			<a class="webbtn" href="?d=manage&cnum=<?=$cnum?>&m=usera&a=form&id=0">新增</a>
			</td>
			<td align="right">
			
			</td>
			</tr>
			</table>
			
			
			
			</div>
			<div class="blank10"></div>
			<div id="viewshow" style="overflow:auto"></div>
		</div>
		<div class="blank10"></div>
	</div>
</div>



<?php 
include_once(''.P.'/public/footer.html');
?>
</div>

</body>
</html>